# -*- coding: utf-8 -*-
""" 测试计算器性能 """

import cProfile
from application.input_init import input_init
from tests.input.olga_case_data import *
from tests.input.game_case_data import *
from application.simulator_interface import time_process


def test_profile_performance():
    pr = cProfile.Profile()
    pr.enable()

    # 开始测试
    case = game_test_5
    time_process(input = case, specific_end_time = 200, flow_pattern_existence=False)

    pr.disable()
    pr.dump_stats('performance.prof')

    print("Performance profile has been saved as 'performance.prof'.")
    print("You can visualize it using SnakeViz by running:")
    print("snakeviz performance.prof")

if __name__ == "__main__":
    test_profile_performance()

